/*
	虚基类：
	class toplevel: public level1, public level2 // 继承基类顺序从左到右
	class toplevel: public level1, virtual public level2 // 声明virtual,则先执行 virtual public level2, 后执行public level1
*/
#include <iostream>

using namespace std;

class base {
	public:
		base() {cout << "base" << endl;}
		~base() {cout << "~base" << endl;}
};

class base2 {
	public:
		base2() {cout << "base2" << endl;}
		~base2() {cout << "~base()" <<endl;}
};

class level1: public base2, virtual public base {
	public:
		level1() { cout << "level1" << endl;}
		~level1() { cout << "~level1" << endl;}
};

class level2:public base2, virtual public base {
	public:
		level2() { cout << "level2" << endl;}
		~level2() {cout << "~level2" << endl;}
};

class toplevel: public level1, virtual public level2 {
public:
	toplevel() { cout << "toplevel" << endl;}
	~toplevel() { cout << "~toplevel" << endl;}
};

int main(int argc, char * argv[]) {
	toplevel biubiubiu;

	return 0;
}
